﻿using DAL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public class RoomTypeBLL
    {
        public RoomTypeDAL RoomTypeDAL { get; }

        public RoomTypeBLL(RoomTypeDAL roomTypeDAL)
        {
            RoomTypeDAL = roomTypeDAL;
        }
        /// <summary>
        /// 添加房型
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int RoomTypeAdd(RoomTypeModel info)
        {
            try
            {
                return RoomTypeDAL.RoomTypeAdd(info);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示查询分页
        /// </summary>
        /// <param name="totalCount"></param>
        /// <param name="totalPage"></param>
        /// <param name="Pageindex"></param>
        /// <param name="Pagesize"></param>
        /// <param name="RoomTypName"></param>
        /// <returns></returns>
        public List<RoomTypeModel> GetRoomTypeList(out int totalCount, out int totalPage, int Pageindex = 1, int Pagesize = 2, string? RoomTypName = "")
        {
            try
            {
               return RoomTypeDAL.GetRoomTypeList(out totalCount, out totalPage, Pageindex, Pagesize, RoomTypName);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 房型Id查询
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public RoomTypeModel GetRoomTypeId(int id)
        {
            try
            {
                return RoomTypeDAL.GetRoomTypeId(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int RoomTypeDel(int id)
        {
            try
            {
               return RoomTypeDAL.RoomTypeDel(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 房型修改
        /// </summary>
        /// <param name="roomType"></param>
        /// <returns></returns>
        public int RoomTypeUpdate(RoomTypeModel info)
        {
            try
            {
               return RoomTypeDAL.RoomTypeUpdate(info);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
